const app = getApp();
Component({
  properties: {
    extClass: {
      type: String,
      value: ''
    },
    current: {
      type: Number,
      value: 0
    },
    selectedColor: {
      type: String,
      value: '#7a7a7a'
    },
    list: {
      type: Array,
      value: app.globalData.config['selectedTarbarType'] === 'Agent' ? app.globalData.config['AgentTarbarList'] : app.globalData.config['AdminTarbarList']
    }

  },
  data: {
    color: "#7a7a7a",
    backgroundColor: "#ffffff"
  },
  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached: function() {

    },
    moved: function() {},
    detached: function() {},
  },
  ready: function() {},

  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const url = data.path;
      let pages = getCurrentPages();
      let currentPage = pages[pages.length - 1];
      let currentUrl = '/' + currentPage.route;
      if (currentUrl !== url) {
        wx.reLaunch({
          url
        })
      }
    }
  }
})